import zkxTitle from "./zkx-title"
import zkxLoading from "./zkx-loading"
import zkxNotice from "./zkx-notice"
import createComponent from './create-component'

const components = [
  zkxTitle,
  zkxLoading,
  zkxNotice
]

const install = function (Vue) {
  components.forEach(component => {
    Vue.component(component.name, component);
  });
  Vue.prototype.zkxNotice = (props) => createComponent(zkxNotice, props)
};

export default {
  install,

  success(props) {
    props = Object.assign({ title: '提示' }, props)

    return createComponent(zkxNotice, props)
  },

  fail(props) {
    props = Object.assign({ title: '警告' }, props)

    return createComponent(zkxNotice, props)
  }
}